package nc.ui.qc.checkstandardmatch.editor;

import nc.ui.pub.beans.UIRefPane;
import nc.ui.pub.bill.*;
import nc.ui.pubapp.uif2app.view.IBillCardPanelEditHandler;
import nc.ui.qc.checkstandard.ref.CheckStandardRefModel;
import nc.ui.scmpub.ref.FilterRefUtils;

public class ChkStdMatchFilterStandard
    implements IBillCardPanelEditHandler
{

    public ChkStdMatchFilterStandard()
    {
    }

    public void afterEdit(BillCardPanel billcardpanel, BillEditEvent billeditevent)
    {
    }

    public boolean beforeEdit(BillCardPanel billCardPanel, BillEditEvent e)
    {
        BillItem chkStdItem = billCardPanel.getBodyItem("pk_checkstandard");
        CheckStandardRefModel model = (CheckStandardRefModel)((UIRefPane)chkStdItem.getComponent()).getRefModel();
        model.setHistoryVersionRef(false);
        FilterRefUtils filter = new FilterRefUtils(chkStdItem);
        String pk_org = (String)billCardPanel.getBodyValueAt(e.getRow(), "pk_org");
        filter.filterItemRefByOrg(pk_org);
        filter.filterItemRefByWhereSql(" dr = '0'");
        return true;
    }
}